<template>
  <div v-if="Object.keys(paramsInfo).length !== 0" class="detail-params">
    <!-- 尺码信息 -->
    <table
      v-for="(table, index) in paramsInfo.sizes"
      class="info-size"
      :key="index"
    >
      <tr v-for="(tr, indey) in table" :key="indey">
        <td v-for="(td, indez) in tr" :key="indez">{{ td }}</td>
      </tr>
    </table>

    <!-- 产地等详细信息 -->
    <table class="info-params">
      <tr v-for="(item, index) in paramsInfo.infos" :key="index">
        <td class="info-param-key">{{ item.key }}</td>
        <td class="param-value">{{ item.value }}</td>
      </tr>
    </table>

    <!-- 图片展示信息 -->
    <div class="info-img" v-if="paramsInfo.image.length !== 0">
      <img :src="paramsInfo.image" alt="" />
    </div>
  </div>
</template>

<script>
export default {
  name: 'DetailParamsInfo',
  props: {
    paramsInfo: {
      type: Object,
      default() {
        return {}
      }
    }
  }
}
</script>

<style type="text/css" scoped>
.detail-params {
  padding: 20px 15px;
  font-size: 14px;
  border-bottom: 5px solid #f2f5f8;
}

.detail-params table {
  width: 100%;
  border-collapse: collapse;
}

.detail-params table tr {
  height: 42px;
}

.detail-params table tr td {
  border-bottom: 1px solid rgba(100, 100, 100, 0.1);
}
.info-size tr td:first-child {
  width: 70px;
}
.info-param-key {
  /*当value的数据量比较大的时候, 会挤到key,所以给一个固定的宽度*/
  width: 95px;
}

.info-param {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.param-value {
  color: #eb4868;
}

.info-img img {
  width: 100%;
}
</style>
